{include file="header/index" /}
<div class="newContentBox">
    <ul class="layui-nav change-nav" lay-filter="">
         {volist name="config_group_list" id="group"}
        <li class="layui-nav-item  {eq name='id' value='$key'}layui-this{/eq}"><a href="{:url('?id='.$key)}">{$group}</a></li>
        {/volist}
    </ul>
    <form class="layui-form newListPart layui-none-top">
        {if $list}
        {volist name="list" id="config"}
        <div class="layui-one-list">
            <div class="layui-form-item cover_layui_f_i">
                <label class="layui-form-label cover_layui_f_l">{$config.title}：</label>
                <div class="layui-input-block cover_layui_i_b">
                    {switch name="config.type"}
                    {case value="0"}
                        <input type="text" name="config[{$config.name}]" value="{$config.value}" required  lay-verify="required"  autocomplete="off" class="layui-input">
                        <div class="tishow"><i class="fa fa-info-circle"></i> {$config.remark}</div>
                    {/case}
                    {case value="1"}
                        <input type="text" name="config[{$config.name}]" value="{$config.value}"  autocomplete="off" class="layui-input">
                        <div class="tishow"><i class="fa fa-info-circle"></i> {$config.remark}</div>
                    {/case}
                    {case value="2"}
                       <textarea class="layui-textarea layui-input"  type="text" rows="4" name="config[{$config.name}]">{$config.value}</textarea>
                       <div class="tishow"><i class="fa fa-info-circle"></i> {$config.remark}</div>
                    {/case}
                    {case value="3"}
                       <textarea class="layui-textarea layui-input"  type="text"  rows="4" name="config[{$config.name}]">{$config.value}</textarea>
                       <div class="tishow"><i class="fa fa-info-circle"></i> {$config.remark}</div>
                    {/case}
                    {case value="4"}
                        <select name="config[{$config.name}]" id="config[{$config.name}]">
                            {volist name=":parse_config_attr($config['extra'])" id="vo"}
                                <option value="{$key}" {eq name="config.value" value="$key"}selected{/eq}>{$vo}</option>
                            {/volist}
                        </select>
                        <div class="tishow"><i class="fa fa-info-circle"></i> {$config.remark}</div>
                    {/case}
                {/switch}
                </div>  
            </div>
        </div>
         {/volist}
        {/if}
        <div class="layui-one-list">
            <div class="layui-form-item">
                        <label class="layui-form-label cover_layui_f_l"><span class="cover_new_label">*</span>富文本编辑器</label>
                        <div class="layui-input-block cover_layui_i_b cover_layui_i_b_text">
                                <textarea class="layeditDemo" style="display: none;width: 300px"></textarea>
                        </div>
                </div>
                <div class="layui-form-item ">
                    <div class="layui-input-block cover_layui_i_b">
                        <button class="layui-btn newBtnDefault newBtnPrimary" lay-submit lay-filter="formDemo">保存</button>
                        <button type="reset" class="layui-btn newBtnDefault">重置</button>
                    </div>
                </div>
         </div>
    </form>
    
</div>
<script>
    var layer = layui.layer,
        element = layui.element,
        laydate = layui.laydate,
        laypage = layui.laypage,
        form = layui.form,
        upload = layui.upload,
        layedit = layui.layedit;
        form.render();

    //提交表单
    var flag = false;
      form.on('submit(formDemo)', function(data){

        if(flag){
        return false;
        }
        flag = true;
        delete data.field.file //true
        console.log('数组',data.field);
        $.post("{:url('save')}",data.field,function(e){
          if(e.code == 1){
            top.layer.msg(e.msg, {
              icon: 1,
              time: 2000
            },function(){
              top.layer.close();
              // history.go(-1); 
              // window.location.href = returndata.data
            });
          }else{
            top.layer.msg(e.msg, {
              icon: 0,
              time: 2000
            });
          }
          flag = false;
        },'json');
        return false;
      });

</script>

